<CFQUERY NAME="getclient" DATASOURCE="#dsn#">
select *
from tblcustomers
where CustomerNum = <cfqueryparam cfsqltype="cf_sql_integer" value="#accountnumber#">

</CFQUERY>
<cfoutput>
<cfset today = dateformat(now(), "yyyy/mm/dd")>
<CFSET new_date = #CREATEODBCDATETIME(today)#>
</cfoutput>


<CFQUERY NAME="getorders" DATASOURCE="#dsn#">
select *
from tblpayments
<cfif isdefined("form.ReceiptNum")>where ReceiptNum = #ReceiptNum#<cfelse>where TransDate >= #new_date#</cfif>
</CFQUERY>



<CFQUERY NAME="getitemssum" DATASOURCE="#dsn#">
select sum(Amount) as total
from tblpayments
<cfif isdefined("form.ReceiptNum")>where ReceiptNum = #ReceiptNum#<cfelse>where TransDate >= #new_date#</cfif>
</CFQUERY>

<CFQUERY NAME="gettaxsum" DATASOURCE="#dsn#">
select sum(TaxAmount) as total
from tbltransactions, tblorders
where tbltransactions.ReceiptNum = tblorders.ReceiptNum and <cfif isdefined("form.ReceiptNum")>tblorders.ReceiptNum = #ReceiptNum#<cfelse>tblorders.TransDate >= #new_date#</cfif>
</CFQUERY>





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#container {
	width:650px;
	height:450px;
	text-align:center;
}
#myform {
	position:relative;
	float:left;
	top:4px;
	width:648px;
	height:53px;
	z-index:1;
	text-align:left;
	left: 0;
}
.style1 {font-size:18px;
color:#000;
}
#items {
	position:relative;
	float:left;
	top:10px;
	width:648px;
	height:300px;
	z-index:2;
	overflow: scroll;
	left: 0;
}
body,td,th {
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12px;
}
#total {
	position:relative;
	float:left;
	top:50px;
	width:648px;
	height:50px;
	z-index:3;
	left: 0;
}
	
-->
</style></head>

<body onLoad="document.form1.ProdID.focus()" background-repeat:repeat-x;margin:0px auto;text-align:left; bgcolor="#FFFFFF">



<div id="container"><div id="myform">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="middle"><cfoutput><cfform name="form1" id="form1" method="post" action="transactions.cfm">
    <label>
      <span class="style1">Receipt Number:</span>
      <cfinput type="text" name="ReceiptNum" class="style1" style="border-color:transparent" size="24" onChange="form1.submit()">
    </label>
  </cfform></cfoutput></td>
    <td align="right"><cfoutput>Today Date: #dateformat(today, "dddd, mmmm dd yyyy")#</cfoutput></td>
  </tr>
</table>

</div>
  <div id="items">
    <cfif isdefined("url.message")><cfoutput><br />#message#</cfoutput></cfif><table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolor="#eeeeee">
      <tr>
        <td width="20%" height="20" align="center" valign="middle" bgcolor="#eeeeee">Receipt Num</td>
        <td width="25%" height="20" align="left" valign="middle" bgcolor="#eeeeee">TransType</td>
        <td width="25%" height="20" align="center" valign="middle" bgcolor="#eeeeee">PaymentType</td>
        <td width="14%" height="20" align="center" valign="middle" bgcolor="#eeeeee">Tax</td>
        <td width="15%" height="20" align="left" valign="middle" bgcolor="#eeeeee">Price</td>
        <td width="15%" height="20" align="left" valign="middle" bgcolor="#eeeeee">View</td>
      </tr>
      <cfoutput query="getorders">
      <CFQUERY NAME="getTAX" DATASOURCE="#dsn#">
select SUM(Price) AS TOTAL, SUM(TaxAmount) AS TAXTOTAL
from tbltransactions
where ReceiptNum= #ReceiptNum#
</CFQUERY><tr>
        <td height="25" align="center">#ReceiptNum#</td>
        <td height="25">#TransType#&nbsp;</td>
        <td height="25" align="center">#PaymentType#</td>
        <td height="25" align="center">#LSCURRENCYFORMAT(getTAX.TAXTOTAL)#</td>
        <td height="25">#LSCURRENCYFORMAT(getTAX.TOTAL)#</td>
        <td height="25"><a href="paperreceipt.cfm?ReceiptNum=#ReceiptNum#"><img src="images/edit2.gif" border="0" /></a></td>
      </tr></cfoutput>
    </table>
  </div>
  <div id="total">
  <table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr class="style1">
    <td width="20%" height="35">&nbsp;</td>
    <td width="47%" height="35" align="right">Total Tax:</td>
    <td width="9%" height="35" align="left"><strong><cfoutput><CFIF #gettaxsum.total# lte 0>$0.00<cfelse>#LSCURRENCYFORMAT(gettaxsum.total)#</CFIF></cfoutput></strong></td>
    <td width="12%" height="35" align="right">Total: </td>
    <td width="12%" height="35" align="left"><strong><cfoutput><CFIF #getitemssum.total# lte 0>$0.00<cfelse>#LSCURRENCYFORMAT(getitemssum.total)#</CFIF></cfoutput></strong></td>
  </tr>
</table>
</div>
</div>
</body>
</html>